classdef Pressure_dev < Processor_dev
  % Class for calculating pressure ala SBE Data Processing
  % Derived from Processor_dev
  % Constructor signature: P = Pressure_dev(data, conn), both arguments opt.
  %
  % Author: David Goldsmith, Wash. State Dept. of Ecology, dgol461@ecy.wa.gov
  % Release date: N/A
  
    properties
      % inherited from Processor_dev
%         inData;
%         castDT;
%         scanRate;
%         ParamID;
%         ParamDesc;
%         SBEprec;
%         EquipID;
        DBdata;
        outData;
    end
    
    methods
      % inherited from Processor_dev
      %   getDBdata;
      %   getSBEprec;
      %   dateValidateData;
        function P = Pressure_dev(data, conn) % Constructor
            if nargin < 1, data = []; end
            if nargin < 2, conn = []; end
            P = P@Processor_dev(data);
            if ~isempty(conn), P.getDBdata(conn, 'P'); end
            if ~isempty(data) && ~isempty(conn), P.mainFormula; end
        end
        
        function mainFormula(obj)
            tmp = obj.inData.Sensors.PressureSensor;
            p = obj.inData.Pn;
            P = [1+0*p p p.*p] * [tmp.A0; tmp.A1; tmp.A2] - 14.7; % need psiG
            psi2db = obj.DBdata.Psi2db; % http://www.seabird.com/application_notes/AN73.htm
            obj.outData = psi2db * P + tmp.Offset;
        end
        
    end
    
end